package com.flowerSystem.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;

import com.flowerSystem.entity.Productinformation;
import com.flowerSystem.mapper.ProductInformationMapper;
import com.flowerSystem.pojo.ProductInformationCollection;
import com.flowerSystem.pojo.ProductinformVo;
import com.flowerSystem.pojo.ProductinformationPojo;
import com.flowerSystem.pojo.ProductinformationVo;
import com.flowerSystem.service.ProductInformationService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.flowerSystem.util.PageResult;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 鲜花遇上牛战士
 * @since 2023-08-28
 */
@Service
public class ProductinformationServiceImpl extends ServiceImpl<ProductInformationMapper, Productinformation> implements ProductInformationService {
    @Resource
    private ProductInformationMapper productinformationMapper;
    @Override
    public boolean updatProductById(Productinformation productinformation) {
        return productinformationMapper.updateProductById(productinformation);
    }

    @Override
    public PageResult productInformByNameType(ProductinformVo productinformVo) {
        PageHelper.startPage(productinformVo.getPageNum(), productinformVo.getPageSize());
        Page<ProductinformationPojo> page = productinformationMapper.productInformByNameType(productinformVo);
        return new PageResult(page.getTotal(),page.getResult());
    }

    @Override
    public ProductinformationVo productInformSingle(int id) {
        return productinformationMapper.productInformSingle(id);
    }

    @Override
    public PageResult productInformSelectAll(Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        Page<Productinformation> page = productinformationMapper.productInformSelectAll();
        return new PageResult(page.getTotal(), page.getResult());
    }
}
